import numpy as np 
import pandas as pd
from sklearn.metrics import mean_squared_error
from sklearn.metrics import r2_score

def mse(y_true,y_pred):
    y_true = np.array(y_true)
    y_pred = np.array(y_pred)
    return (((y_true - y_pred) ** 2).mean())
    # return s

# def r2(y_true,y_pred):
#     y_true = np.array(y_true)
#     y_pred = np.array(y_pred)
#     return (1 - sum(((y_true - y_pred) ** 2) / sum((y_true - ((sum(y_true)).mean() + (y_true - y_pred)) ** 2) ** 2)))


y_true = [3,-0.5,2,7]
y_pred = [2.5,0.0,2,8]
# print(mse(y_true,y_pred))
# print(mean_squared_error(y_true,y_pred))
print(r2_score(y_true,y_pred))
print(r2_score(y_true,y_pred))